<template>
    <view class="map-container">
        <view class="title">经度：{{longitude}}，纬度：{{latitude}}</view>
        <button size="small" class="mt15" @click="getLocation">获取位置</button>
    </view>
</template>

<script>
    // import jweixin from 'jweixin-module'
    export default {
        name: "index",
        data: () => {
            return {
                longitude: '',//经度
                latitude:'',//纬度
            }
        },
        async onLoad() {
        },
        methods: {
            getLocation() {
                let _ = this
                uni.chooseLocation({
                    complete: async (res) => {
                        if (res.errMsg === "chooseLocation:ok") {
                            uni.showLoading({
                                title: '获取中'
                            })
                            _.longitude = res.longitude
                            _.latitude = res.latitude
                            console.log('chooseLocation', res)
                            uni.hideLoading()
                        } else {
                        }
                    }
                })
            },

        }

    }
</script>

<style lang="scss" scope>
    @import 'index.scss';
</style>
